<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

	<!-- Import JsUnit core test library -->
    <script type="text/javascript" src="jsunit/app/jsUnitCore.js"></script>
    
    <!-- Import trialjs - JavaScript test helper library (see http://trialjs.googlecode.com/) -->
    <script type="text/javascript" src="../lib/trial.js"></script>
    
    <!-- Import jQuery -->
    <script type="text/javascript" src="../lib/jquery-1.3.1.js"></script>
    
    <!-- Import fake query source -->
    <script type="text/javascript" src="../src/fake-query.src.js"></script>

	<!-- Test scripts -->
    <script type="text/javascript">

		/*
			Static methods
		*/
		function test_static_array_exists(){

			assertNotUndefined("$$.discovery.staticMethods", $$.discovery.staticMethods);
			assertNotNull("$$.discovery.staticMethods", $$.discovery.staticMethods);
			
		}

		function test_some_known_static_methods(){

			var expectedStaticMethods = ["extend", "noConflict", "isFunction", "isArray", "isXMLDoc", "globalEval", "nodeName", "each", "prop", "swap", "css", 
			                             "curCSS", "clean", "attr", "trim", "makeArray", "inArray", "merge", "unique", "grep", "map", "data", 
			                             "removeData", "queue", "dequeue", "find", "filter", "multiFilter", "dir", "nth", "sibling", "Event", "ready", 
			                             "get", "getScript", "getJSON", "post", "ajaxSetup", "ajax", "handleError", "httpSuccess", "httpNotModified", "httpData", "param", 
			                             "speed", "fx"];

			var doesContainArguments = [];

			// add the subject
			doesContainArguments.push($$.discovery.staticMethods);

			// and each item
			for (var i in expectedStaticMethods) { 

				doesContainArguments.push(expectedStaticMethods[i]);

				// make sure this method exists as a static method
				assertNotUndefined("$." + expectedStaticMethods[i] + "() should be a static method.", $[expectedStaticMethods[i]]);

				// the actual method itself will be tested by the
				// methods-that-log-tests.htm page
				
			}
			
			assertTrue("Not all expected static methods were present.", 
					trial.doesContain.apply(trial, doesContainArguments));
			
		}

		/*
			Instance Methods
		*/
		function test_instance_array_exists(){

			assertNotUndefined("$$.discovery.instanceMethods", $$.discovery.instanceMethods);
			assertNotNull("$$.discovery.instanceMethods", $$.discovery.instanceMethods);
			
		}

		function test_some_known_instance_methods(){

			var expectedInstanceMethods = ["width", "outerWidth", "innerWidth", "height", "outerHeight", "innerHeight", "scrollTop", "scrollLeft", "offsetParent", "position", "offset", 
			                             "fadeOut", "fadeIn", "slideToggle", "slideUp", "slideDown", "stop", "animate", "fadeTo", "_toggle", "hide", "show", 
			                             "ajaxSend", "ajaxSuccess", "ajaxError", "ajaxComplete", "ajaxStop", "ajaxStart", "serializeArray", "serialize", "_load", "error", "keyup", 
			                             "keypress", "keydown", "submit", "select", "change", "mouseleave", "mouseenter", "mouseout", "mouseover", "mousemove", "mouseup", 
			                             "mousedown", "dblclick", "click", "unload", "scroll", "resize", "load", "focus", "blur", "die", "live", 
			                             "ready", "hover", "toggle", "triggerHandler", "trigger", "unbind", "one", "bind", "dequeue", "queue", "removeData", 
			                             "data", "empty", "remove", "toggleClass", "removeClass", "addClass", "removeAttr", "replaceAll", "insertAfter", "insertBefore", "prependTo", 
			                             "appendTo", "contents", "children", "siblings", "prevAll", "nextAll", "prev", "next", "parents", "parent", "extend", 
			                             "domManip", "andSelf", "map", "slice", "eq", "replaceWith", "html", "val", "hasClass", "is", "add", 
			                             "not", "closest", "filter", "clone", "find", "push", "end", "after", "before", "prepend", "append", 
			                             "wrap", "wrapInner", "wrapAll", "text", "css", "attr", "index", "each", "setArray", "pushStack", "get"];

			var doesContainArguments = [];

			// add the subject
			doesContainArguments.push($$.discovery.instanceMethods);

			var instance = $("selector");
			
			// and each item
			for (var i in expectedInstanceMethods) {
				doesContainArguments.push(expectedInstanceMethods[i]);

				// make sure this method exists as an instance method
				assertNotUndefined("$()." + expectedInstanceMethods[i] + "() should be an instance method.", instance[expectedInstanceMethods[i]]);
				
			}
			
			assertTrue("Not all expected instance methods were present.", 
					trial.doesContain.apply(trial, doesContainArguments));
			
		}

		
    </script>
    
</head>
</html>